<!doctype html>
<html lang="en">

<head>
	<meta charset="utf-8" />
	<title>光禽脚标机管理系统登陆</title>
	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
	<meta content="A fully featured admin theme which can be used to build CRM, CMS, etc." name="description" />
	<meta content="Coderthemes" name="author" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />

	<!-- App favicon -->
	<link rel="shortcut icon" href="assets/images/favicon.ico">

	<!-- App css -->
	<link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
	<link href="assets/css/icons.css" rel="stylesheet" type="text/css" />
	<link href="assets/css/metismenu.min.css" rel="stylesheet" type="text/css" />
	<link href="assets/css/style.css" rel="stylesheet" type="text/css" />
	<link rel="stylesheet" type="text/css" href="assets/css/custom.css" />

	<script src="assets/js/modernizr.min.js"></script>

</head>

<body class="account-pages">

	<!-- Begin page -->
	<div class="wrapper-page account-page-full">

		<div class="card">
			<div class="card-block">

				<div class="account-box">

					<div class="card-box p-5">
						<h2 class="text-uppercase text-center pb-4">
							<a href="index.html" class="text-success">
								<span><img src="assets/images/logo.png" alt="" height="26"></span>
							</a>
						</h2>

						<form class="" action="#" role="form">

							<div class="form-group row m-b-20">
								<div class="col-12">
									<label for="username">账户</label>
									<input class="form-control" type="text" required="" id="username" name="username"
										placeholder="请输入用户名">
								</div>
							</div>
							<div class="form-group row m-b-20">
								<div class="col-12">
									<label for="password">密码</label>
									<input class="form-control" type="password" required="" id="password"
										name="password" placeholder="请输入密码">
									<a href="recoverpw.html" class="text-muted float-right"><small>忘记密码</small></a>
								</div>
							</div>

							<div class="form-group row m-b-20">
								<div class="col-12">

									<div class="checkbox checkbox-custom">
										<input id="remember" type="checkbox">
										<label for="remember">记住我（非本人电脑勿点）</label>
									</div>

								</div>
							</div>

							<div class="form-group row text-center m-t-10">
								<div class="col-12">
									<button class="btn btn-block btn-custom waves-effect waves-light"
										type="submit">登陆</button>
								</div>
							</div>

						</form>

						<div class="row m-t-50">
							<div class="col-sm-12 text-center">
								<p class="text-muted">还没有账号密码? <a href="register.html"
										class="text-dark m-l-5"><b>注册</b></a></p>
							</div>
						</div>

					</div>
				</div>

			</div>
		</div>

		<div class="m-t-40 text-center">
			<p class="account-copyright">2018 © Highdmin. - Coderthemes.com</p>
		</div>

	</div>

	<!-- jQuery  -->
	<script src="assets/js/jquery.min.js"></script>
	<script src="assets/js/bootstrap.bundle.min.js"></script>
	<script src="assets/js/metisMenu.min.js"></script>
	<script src="assets/js/waves.js"></script>
	<script src="assets/js/jquery.slimscroll.js"></script>

	<!-- App js -->
	<script src="assets/js/jquery.core.js"></script>
	<script src="assets/js/jquery.app.js"></script>
	<!-- layer插件 -->
	<script src="plugins/layer2.4/layer.js" type="text/javascript" charset="utf-8"></script>

	<script src="assets/js/custom.js" type="text/javascript" charset="utf-8"></script>

	<!-- 表单验证 -->
	<script src="plugins/jquery.form.js/jquery.form.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="plugins/jquery.validation.1.14.0/jquery.validate.js" type="text/javascript" charset="utf-8"></script>
	<script src="plugins/jquery.validation.1.14.0/validate-methods.js" type="text/javascript" charset="utf-8"></script>
	<script src="plugins/jquery.validation.1.14.0/messages_zh.js" type="text/javascript" charset="utf-8"></script>
	<!-- bootstrap-select -->
	<script src="plugins/bootstrap-select/js/bootstrap-select.js" type="text/javascript" charset="utf-8"></script>

	<script src="plugins/jquery-easyUI/jquery.easyui.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="plugins/jquery-easyUI/easyui-lang-zh_CN.js" type="text/javascript" charset="utf-8"></script>
	<!-- 星空背景 -->
	<script src="assets/js/background.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		$(function () {
			//回显
			var username = getCookie("loginUsername")
			var password = getCookie("loginPassWord")
			
			if (username != "" && password != "") {
				$("#username").val(username)
				$("#password").val(password)
			}
			$("#username").val(username)

			//表单验证
			$("form").validate({
				rules: {
					username: {
						required: true,
					},
					password: {
						required: true,
					},
				},
				onkeyup: false,
				focusCleanup: true,
				success: "valid",
				submitHandler: function (form) {
					$(form).ajaxSubmit({
						type: "POST",
						url: URL + "person/login",
						success: function (data) {
							if (data.msg == "账户或密码错误") {
								parent.layer.msg(data.msg, {
									icon: 2,
									time: 1000
								});
								return
							}
							if (data.msg == "用户名或密码为空") {
								parent.layer.msg(data.msg, {
									icon: 2,
									time: 1000
								});
								return
							}
							parent.layer.msg(data.msg, {
								icon: 1,
								time: 1000
							});
							delCookie("loginUsername")
							delCookie("userid")
							setCookie("loginUsername", $("#username").val(), "d9")
							setCookie("userid", $("#username").val(), "d9")
							
							if ($('#remember').is(':checked')) {
								delCookie("loginPassWord")
								setCookie("loginPassWord", $("#password").val(), "d9")
							}
							window.location.pathname = '/index.html'
						},
						error: function (XMLHttpRequest, textStatus, errorThrown) {
							networkError(XMLHttpRequest, textStatus, errorThrown)
						}
					});
				}
			});
		});
	</script>
</body>

</html>